//设置 + 获取 + 清除
function setCookie(key, value, t){
	var oDate = new Date();
	oDate.setDate( oDate.getDate() + t );

	document.cookie = key + '=' + encodeURI(value)+';expires=' + oDate.toGMTString();
}

function getCookie(key){
	var arr1 = document.cookie.split('; ');
	var arr2 = [];
	//alert(arr1)								//arr1=["username=leo","age=32"]
	for (var i = 0; i < arr1.length; i++) {
		arr2.push( arr1[i].split('=') );
	};
	//alert(arr2)							//arr2=[ ["username","leo"],["age","32"] ]
	
	for (var i = 0; i < arr2.length; i++) {
		if (arr2[i][0] == key) {
			return decodeURI( arr2[i][1] );
			// break;
		}
	}
}

function removeCookie(key){
	setCookie(key, '', -1)
}